package com.gai.shop.dao;

import com.gai.shop.entity.Cart;

import java.util.List;

public interface CartDao {
    /**
     * 通过uid和pid来查找是否有购物车数据存在
     * @param uid
     * @param pid
     * @return
     */
    Cart selectCartProductByUidAndPid(Integer uid, Integer pid) throws Exception;

    /**
     * 新增购物车数据
     * @param cart
     * @return
     */
    Integer insertIntoCart(Cart cart) throws Exception;

    /**
     * 购物车数据修改
     * @param cart 购物车小计
     * @return
     */
    Integer updateCartSetCnumAndCcount(Cart cart) throws Exception;

    /**
     * 通过uid来查找是否有购物车数据存在
     * @param uid
     * @return
     */
    List<Cart> selectCartProductByUidAndPid(Integer uid) throws Exception;

    /**
     * 清空购物车
     * @param uid
     * @return
     */
    Integer deleteCartByUid(Integer uid) throws Exception;

    /**
     * 删除购物车数据
     * @param uid
     * @param pid
     * @return
     */
    Integer deleteCartByUid(Integer uid, Integer pid) throws Exception;

    /**
     * 购物车数据修改
     * @param ccount 购物车小计
     * @param cnum 购物车商品的数量
     * @return
     */
//    Integer updateCartSetCnumAndCcount(Double ccount,Integer cnum);
}
